package com.fenqing.leetcode.code.t1600_1700;

import com.fenqing.annotations.Execute;
import com.fenqing.core.Topic;

/**
 * @author fenqing
 */
public class Topic1678 extends Topic {
    /**
     * 构造器
     *
     * @param input 输入
     */
    public Topic1678(String input) {
        super(input);
    }

    @Execute
    public String interpret(String command) {
        char[] chars = command.toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < chars.length; i++) {
            char ch = chars[i];
            if (ch == 'G') {
                sb.append(ch);
            } else if (ch == '(') {
                if (chars[i + 1] == ')') {
                    sb.append('o');
                    i += 1;
                } else {
                    sb.append("al");
                    i += 3;
                }
            }
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        String run = new Topic1678("G()(al)").run();
        System.out.println(run);
    }

}
